import {Body, Controller, Get, Param, Post, Query} from '@nestjs/common';
import { AppService } from './app.service';
import {encodedDto} from "./dto/appDto";

@Controller('/demo/user')
export class AppController {
  constructor(private readonly appService: AppService) {}

  @Post('formUrl')
  getFormUrlEncoded(@Body() user: encodedDto)  {
    return `返回的数据${user.name} - ${user.age}`
  }

  @Get('detail')
  getDetail(@Query() data: encodedDto) {
    return this.appService.getDetailById(data.id)
  }

  @Get(':name')
  getUrlParam(@Param('name') name:string): string {
    return 'query 方式的 ' + name
  }


}
